//
//  OffsetListCell.m
//  Supermarket
//
//  Created by qskj-ios on 2018/12/10.
//  Copyright © 2018年 com.qiansheng. All rights reserved.
//

#import "OffsetListCell.h"
#import "OffsetModel.h"

@implementation OffsetListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self customBorderWithSize:kSeparatorHeight andPosition:UIViewBorderPositionBottom andColor:kSeparatorColor andLeadingInset:10 andTrailingInset:0];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setContentWithOffset:(OffsetModel *)model {
    self.priceLabel.text = [NSString stringWithFormat:@"¥%@" ,model.denomination];
    self.userLabel.text = [NSString stringWithFormat:@"%@ %@" ,model.user_name, model.user_mobile];
    self.nameLabel.text = model.c_name;
    if (model.sta == 0) {
        [self.exchangeButton setTitle:@"输入兑换码" forState:UIControlStateNormal];
        [self.exchangeButton setBackgroundColor:RGB_COLOR(30, 194, 137)];
        [self.priceLabel setTextColor:RGB_COLOR(30, 194, 137)];
    } else {
        [self.exchangeButton setTitle:@"已兑换" forState:UIControlStateNormal];
        [self.exchangeButton setBackgroundColor:RGB_COLOR(222, 222, 222)];
        [self.priceLabel setTextColor:kTextColorThree];
    }
}

- (IBAction)didClickedExchangeButton:(id)sender {
    if (self.exchangeButtonBlock) {
        self.exchangeButtonBlock(self);
    }
}

@end
